package com.ffms.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ffms.entity.FamilyMember;
import com.ffms.service.AdminService;
import com.ffms.service.impl.AdminServiceImpl;
//控制层对成员信息的预更新
 @WebServlet("/PreUpdateFMServlet")
public class PreUpdateFMServlet extends HttpServlet {


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		//1.获取要修改的成员姓名
		String name = request.getParameter("name");
		
		//2.调用业务层查询指定编号的成员
		AdminService  adminService = new AdminServiceImpl();
		FamilyMember fm = adminService.findFMByName(name);
		//3.返回成员页面给更新信息
		request.setAttribute("fm", fm);
		request.getRequestDispatcher("/admin/familyMemberUpdate.jsp").forward(request, response);
		
	
	}

}